package top.codestudy.actions;


import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.wm.WindowManager;
import top.codestudy.ui.SwitchCaseDialog;

public class SwitchCaseAction extends AnAction {
    private SwitchCaseDialog switchCaseDialog;
    @Override
    public void actionPerformed(AnActionEvent event) {
        System.out.println("ccc");
        Project project = event.getData(PlatformDataKeys.PROJECT);
        if (switchCaseDialog == null) {
            switchCaseDialog = new SwitchCaseDialog();
        }
        switchCaseDialog.init(event.getData(PlatformDataKeys.EDITOR).getDocument().getText());
        switchCaseDialog.pack();
        switchCaseDialog.setLocationRelativeTo(WindowManager.getInstance().getFrame(event.getProject()));
        switchCaseDialog.setVisible(true);
    }

}
